#include "Property.h"

#include "Reflection/PropertyList.h"

CProperty::CProperty(
		CPropertyList* InParentList
		,CString InName
		,const SDecoratedType& InType
		,TMap<EPropertyFlags,  SReflectionMetaDataValue> InMetaData
	)
{
	Type=InType;
	Name = InName ;
	MetaData = InMetaData;

	ParentList = InParentList;
}

CProperty::~CProperty()
{
	if(NonStaticProperty)
	{
		delete NonStaticProperty;
	}
	if(StaticProperty)
	{
		delete StaticProperty;
	}
	if(FieldProperty)
	{
		delete FieldProperty;
	}
}

CType *CProperty::GetOwnerType()
{
	return ParentList->GetOwnerType();
}

bool CProperty::CanUseInScript()
{
	return !MetaData.Contains(EPropertyFlags::P_NotInScript);
}
